import React, {
    Component,
    PropTypes
} from 'react';
import {
    Router,
    Route,
    IndexRoute,
    browserHistory,
    hashHistory
} from 'react-router';


/**
 * (路由根目录组件，显示当前符合条件的组件)
 *
 * @class Roots
 * @extends {Component}
 */

const Roots = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Common/Roots').default)
    }, 'Roots')
}
const Login = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Login').default)
    }, 'Login')
}
const Register = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Register').default)
    }, 'Register')
}
const ForgetPwd = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/ForgetPwd').default)
    }, 'ForgetPwd')
}
const Map = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Map').default)
    }, 'Map')
}
const Path = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Path').default)
    }, 'Path')
}
const DeviceList = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/DeviceList').default)
    }, 'DeviceList')
}
const AddDevice = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/AddDevice').default)
    }, 'AddDevice')
}
const Gotoactive = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Gotoactive').default)
    }, 'Gotoactive')
}
const VerifyText = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/VerifyText').default)
    }, 'VerifyText')
}
const Success = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Success').default)
    }, 'Success')
}
const kaoqin = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/kaoqin').default)
    }, 'kaoqin')
}
const Safetyarea = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Safetyarea').default)
    }, 'Safetyarea')
}
const Addarea = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Addarea').default)
    }, 'Addarea')
}
const Guardian = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Guardian').default)
    }, 'Guardian')
}
const AddGuardian = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/guardian/AddGuardian').default)
    }, 'AddGuardian')
}
const More = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/More').default)
    }, 'More')
}
const Baby = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Baby').default)
    }, 'Baby')
}

const Authen = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Authen').default)
    }, 'Authen')
}

const Address = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Address').default)
    }, 'Address')
}

const ChangeDevice = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/ChangeDevice').default)
    }, 'ChangeDevice')
}
const Shengji = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Shengji').default)
    }, 'Shengji')
}
const Pay = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Pay').default)
    }, 'Pay')
}
const BuyDevice = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/BuyDevice').default)
    }, 'BuyDevice')
}
const MapDetail = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/MapDetail').default)
    }, 'MapDetail')
}
const Statistics = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Statistics').default)
    }, 'Statistics')
}
const Teacher = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Teacher').default)
    }, 'Teacher')
}
const teacherMore = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/teacherMore').default)
    }, 'teacherMore')
}
const Notice = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/Notice').default)
    }, 'Notice')
}
const TeacherAtt = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/TeacherAtt').default)
    }, 'TeacherAtt')
}
const ExceptionAtt = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/ExceptionAtt').default)
    }, 'ExceptionAtt')
}
const StatisticsAtt = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/StatisticsAtt').default)
    }, 'StatisticsAtt')
}
const kaoqinAtt = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/kaoqinAtt').default)
    }, 'kaoqinAtt')
}
//商户中心登录页
const BuinessLogin = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/Login').default)
    }, 'BuinessLogin')
}
//商户中心首页
const BuinessIndex = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/Index').default)
    }, 'BuinessIndex')
}
//创建商户
const BusinessForm = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/BusinessForm').default)
    }, 'BusinessForm')
}
//商品管理
const GoodsManage = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/GoodsManage').default)
    }, 'GoodsManage')
}
//订单管理
const OrderManage = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/OrderManage').default)
    }, 'OrderManage')
}
//企业资料
const CompanyData = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/CompanyData').default)
    }, 'CompanyData')
}
//消费验证
const ConsumeVerify = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/ConsumeVerify').default)
    }, 'ConsumeVerify')
}
//商品详情
const GoodsDetail = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/GoodsDetail').default)
    }, 'GoodsDetail')
}
//添加商品
const AddGoods = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/AddGoods').default)
    }, 'AddGoods')
}
//订单详情
const OrderDetail = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/OrderDetail').default)
    }, 'OrderDetail')
}
//序列号验证
const NumberVerify = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/NumberVerify').default)
    }, 'NumberVerify')
}

//商品使用情况
const UseInfo = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/UseInfo').default)
    }, 'UseInfo')
}
//测试路由
const BsTest = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/mock/Testt').default)
    }, 'BsTest')
}
//测试路由
const BusinessForgetPwd = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/ForgetPwd').default)
    }, 'BusinessForgetPwd')
}

//测试路由
const BusinessReg = (location, cb) => {
    require.ensure([], require => {
        cb(null, require('./Component/businessCenter/register').default)
    }, 'BusinessReg')
}


// const Test = (location, cb) => {
//     require.ensure([], require => {
//         cb(null, require('./Component/Test').default)
//     }, 'Test')
// }

const RouteConfig = (
    <Router history={hashHistory}>
        <Router path="/" getComponent={Roots}>
            <IndexRoute getComponent={Login}/>
            <Route path="login/:type(/:from)(/:token)" getComponent={Login}/>
            <Route path="register" getComponent={Register}/>
            <Route path="ForgetPwd" getComponent={ForgetPwd}/>
            <Route path="path/:babyid/:lng/:lat" getComponent={Path}/>
            <Route path="map/:token(/:userid)" getComponent={Map}/>
            <Route path="deviceList" getComponent={DeviceList}/>
            <Route path="AddDevice(/:status)" getComponent={AddDevice}/>
            <Route path="Gotoactive/:telephone/:mdtid/:code/:type/:status" getComponent={Gotoactive}/>
            <Route path="VerifyText/:admintelephone/:mdtid/:deviceid/:telephone/:status" getComponent={VerifyText}/>
            <Route path="Success/:time(/:devicetype)" getComponent={Success}/>
            <Route path="Kaoqin/:babyid" getComponent={kaoqin}/>
            <Route path="Safetyarea/:babyid" getComponent={Safetyarea}/>
            <Route path="Addarea/:regionid/:radius/:centerlng/:centerlat/:name" getComponent={Addarea}/>
            <Route path="Guardian/:babyid/:deviceType/:deviceid" getComponent={Guardian}/>
            <Route path="AddGuardian/:babyid/:guardianid/:familystatus" getComponent={AddGuardian}/>
            <Route path="More/:babyid/:integral" getComponent={More}/>
            <Route path="Baby/:babyid" getComponent={Baby}/>
            <Route path="Shengji(/:from)" getComponent={Shengji}/>
            <Route path="ChangeDevice/:telephone/:mdtid/:devicetype" getComponent={ChangeDevice}/>
            <Route path="authen/:phone" getComponent={Authen}/>
            <Route path="Pay/:babyid/:deviceid(/:noback)" getComponent={Pay}/>
            <Route path="Address(/:shengji)" getComponent={Address}/>
            <Route path="BuyDevice(/:shengji)" getComponent={BuyDevice}/>
            <Route path="Statistics" getComponent={Statistics}/>
            <Route path='mapDetail/:babyid/:babyname/:headimg' getComponent={MapDetail}/>
            <Route path='Teacher/:type' getComponent={Teacher}/>
            <Route path='teacherMore/:type/:integral' getComponent={teacherMore}/>
            <Route path='Notice' getComponent={Notice}/>
            <Route path='TeacherAtt' getComponent={TeacherAtt}/>
            <Route path='ExceptionAtt' getComponent={ExceptionAtt}/>
            <Route path='StatisticsAtt(/:studentName)(/:studentId)' getComponent={StatisticsAtt}/>
            <Route path='kaoqinAtt(/:studentName)(/:studentId)' getComponent={kaoqinAtt}/>
            <Route path="businesslogin" getComponent={BuinessLogin}/>//商户登录
            <Route path="businessReg" getComponent={BusinessReg}/>//商户登录
            <Route path="businessForgetPwd" getComponent={BusinessForgetPwd}/>//商户修改密码
            <Route path="businessIndex(/:company)" getComponent={BuinessIndex}/> //商户中心首页
            <Route path="businessForm(/:needAudit)" getComponent={BusinessForm}/> //商户中心首页
            <Route path="goodsManage" getComponent={GoodsManage}/>//商品管理
            <Route path="orderManage" getComponent={OrderManage}/> //订单管理
            <Route path="companyData" getComponent={CompanyData}/> //企业资料
            <Route path="consumeVerify" getComponent={ConsumeVerify}/> //消费验证
            <Route path="bstest" getComponent={BsTest}/> //测试路由
            <Route path="goodsDetail/:goodId" getComponent={GoodsDetail}/>//商品详情
            <Route path="addGoods(/:goodId)" getComponent={AddGoods}/>//添加商品
            <Route path="orderDetail/:id" getComponent={OrderDetail}/>//订单详情
            <Route path="numberVerify" getComponent={NumberVerify}/>//序列号验证
            <Route path="useInfo(/:companyId)(/:get)(/:unUsed)(/:used)" getComponent={UseInfo}/>//商品使用情况
            {/*<Route path='test' getComponent={Test}/>*/}
            <Route path="*" getComponent={Login}/>
        </Router>
    </Router>
);

export default RouteConfig;
